<?php
/**
 * 身份认证
 */
namespace Common\Controller;

use Common\Controller\BaseController;

class AuthController extends BaseController
{
    public function userid()
    {
        $code = $_GET['code'];
        // $access_token = $this->weObj->checkAuth();
        // $res = $this->weObj->http_get('https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo?access_token='.$access_token.'&code='.$code);

        $res = $this->weObj->getUserId($code, 4);
        $info = $this->weObj->getUserInfo($res['UserId']);
        dump($info);
    }

    /**
     * 获取通讯录中的组织架构
     */
    public function getHierarchy()
    {
        $this->hierarchy = $this->weObj->getDepartment();
        dump($this->hierarchy);
        dump($this->weObj->getUserInfo('zhangjv'));
        dump($this->weObj->getUserListInfo(3));
    }
}
